-
Notifications
You must be signed in to change notification settings - Fork 8.7k
fix(opencode): accumulate step tokens for compaction #10215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
fix(opencode): accumulate step tokens for compaction #10215
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate/Related PRs Found:
These PRs all relate to token management, compaction triggering, and overflow prevention. PR #10123 seems most closely related as it deals with custom compaction thresholds and token overflow. Recommend reviewing these to ensure PR #10215's token accumulation logic integrates properly with existing compaction mechanisms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes token accumulation in the OpenCode session processor to properly track cumulative token usage across multi-step loops and enable correct overflow detection for compaction triggers.
Changes:
- Accumulate step-level token usage instead of overwriting per-step values in the assistant message
- Use cumulative tokens for overflow checks to properly trigger compaction in multi-step scenarios
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
740fc40 to
b5b18ae
Compare
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
What does this PR do?
How did you verify your code works?
bun test --timeout 30000 --bail(failed: ConnectionRefused to https://models.dev/api.json)